# koroFileHeader at Yungoal acer
# Create: 2021-10-18 09:41:57
# LastEdit: 2021-10-18 10:40:00
"""https://leetcode-cn.com/problems/first-unique-character-in-a-string/
没写单元测试
"""
__author__ = '749B'


from collections import Counter

class Solution:
    def firstUniqChar(self, s: str) -> int:
        for i, c in Counter(s).items():
            if c == 1:
                return s.index(i)
        return -1

    def firstUniqChar_one_line(self, s: str) -> int:
        """一行代码"""
        return ([s.index(k) for k, v in Counter(s).items() if v == 1] or [-1])[0]
